package com.ddxz.tool.sql.exception;

import com.ddxz.tool.core.common.DdxzStatus;

/**
 * enum description
 *
 * @author 朱宗刚
 * @version 1.0.0
 * @date 2020/7/27
 */

public enum SqlErrorStatus implements DdxzStatus {
    INVALID_SQL(9201, "parse sql [{}] to query tree failed"),
    SUBQUERY_NAME(9202, "missing name for sub-query"),
    UNSUPPORT(9203, "type of query [{}] do not support"),
    SCHEMA_ERROR(9204, "schema must not be null"),
    UNCENTER_COLUMN(9205, "more than one table found, column belongs unspecified table"),
    NO_RESULT_FOUND(9205, "no select item found"),
    NO_TABLE_FOUND(9206, "no table found"),
    REPEAT_ALIAS(9207, "the alias [{}] repeat"),
    INVALID_ORDER(9208, "current version do not support that express in ORDER"),
    UNKNOWN_QUERY_TYPE(9209, "unknown query type {}, valid are [{},{}]"),
    UNKNOW_DATABASE(9210, "create sql parse failed"),
    INVALID_ENUM_CODE(9211, "无效的枚举编号[{}], 有效枚举编号为[{}~{}]");

    private Integer status;

    private String message;

    SqlErrorStatus(Integer status, String message) {
        this.status = status;
        this.message = message;
    }

    @Override
    public Integer getStatus() {
        return status;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
